package org.springsource.controllers;

import java.security.Principal;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springsource.domain.Level;
import org.springsource.service.LevelService;

@Controller
public class LevelController {
	
	@Autowired
	LevelService levelService; 
	
	@RequestMapping(value = "/{countryCode}/level", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
	public @ResponseBody
	List<Level> getAllLevelsByCountryCode(Principal currentUser, Model model,
			@PathVariable String countryCode) {
		return levelService.getAllLevelsByCountryCode(countryCode);
	}
}
